///@file StringUtils.cpp
///@brief Implementation of methods for string management
///@author Arnaud Duval
///@version 0.0
///@date 2010/03/22

#include "../include/StringUtils.h"
#include <iostream>
#include <sstream>


///@brief Convert a positive integer to a string with given size
///@param n integer number to convert
///@param length length of returned string
std::string IntToString(unsigned int n, unsigned int length)
{
	std::string res;
	std::ostringstream oss;
	oss << n;
	res = oss.str();
	while(res.size() < length)
	{
		res = "0"+res;
	}
	return res;
}

///@brief Convert a double to a string with given precision
///@param d double precision number to convert
///@param p precision
std::string DoubleToString(double d, unsigned int p)
{
	std::ostringstream oss;
	oss.precision(p);
	oss << d;
	return oss.str();
}